package crp.services.api.graphql.models;


import crp.core.faculty.domain.models.FacultyEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import org.eclipse.microprofile.graphql.Id;
import org.eclipse.microprofile.graphql.Type;

import javax.validation.constraints.NotNull;

@Type("Faculty")
@Builder
@Getter
@AllArgsConstructor
public class FacultyPayload {
    @Id
    @NotNull
    private final String id;
    @NotNull
    private final String facultyNo;
    @NotNull
    private final String name;

    public static FacultyPayload of(FacultyEntity entity) {
        return FacultyPayload.builder()
                .id(entity.getId())
                .facultyNo(entity.getFacultyNo())
                .name(entity.getName())
                .build();
    }
}
